package com.example.higo.view.activity;

import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;


import com.example.higo.utils.frame.AppManager;

import butterknife.ButterKnife;

/**
 * Created by wj on 2016/11/2.
 */

public abstract class BaseActivity extends AppCompatActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
            AppManager.getAppManager().addActivity(this);
        }
        setContentView(getLayoutId());
        if (savedInstanceState == null) {
            ButterKnife.bind(this);
            init();
        }
    }

    public abstract int getLayoutId();

    public void init() {
        before();
        initView();
        initData();
    }

    public void before() {
    }


    public abstract void initData();

    public abstract void initView();


    @Override
    public void onBackPressed() {
        super.onBackPressed();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }
}
